Hex Function

Returns as a String the hexadecimal version of the number passed.

Syntax

result = Hex( value )


Parameters

value

Integer

The number to be converted to hexadecimal.



Notes

If the value is not a whole number, the decimal value will be truncated.

You can specify binary, hex, or octal numbers by preceding the number with the & symbol and the letter that indicates the number base. The letter b indicates binary, h indicates hex, and o indicates octal.

VB Compatibility Note: VB rounds the value to the nearest whole number so the Hex function will probably be changed in a future release to do this as well.


Examples

Below are examples of various numbers converted to hex:

Dim hexVersion As String
hexVersion=Hex (5) //returns "5"
hexVersion=Hex(75) //returns "4B"
hexVersion=Hex(256) //returns "100"

See Also

&b, &h, &o literals; Bin and Oct functions.